# name : Retrieve Each Word from a Macro Variable List, Rename
# key : rename.varname.macro
# contributor: Shuguang Sun
# --
%let varlist = Age Height Name Sex Weight;

%macro rename;
  %let word_cnt=%sysfunc(countw(&varlist));
  %do i = 1 %to &word_cnt;
    %let temp=%qscan(%bquote(&varlist), &i);
    &temp = _&temp
  %end;
%mend rename;

data new;
  set sashelp.class(rename=(%unquote(%rename)));
run;